package bb.lanxing.lib.devices.bryton.ncs;

import android.text.TextUtils;
import android.util.Pair;
import bb.lanxing.lib.devices.bryton.ncs.constant.CategoryID;
import bb.lanxing.lib.devices.bryton.ncs.constant.EventFlags;
import bb.lanxing.lib.devices.bryton.ncs.constant.EventID;
import java.util.ArrayList;
import java.util.List;

public class ExtensionData {
    public static final int MAX_CONTENT_DESCRIPTION_LENGTH = 1164;
    public static final int MAX_EXPANDED_BODY_LENGTH = 1000;
    public static final int MAX_EXPANDED_TITLE_LENGTH = 100;
    public static final int MAX_STATUS_LENGTH = 32;
    private int mIcon;
    private EventID mEventId = EventID.NOTIFICATION_ADDED;
    private EventFlags mEventFlag = EventFlags.SILENT;
    private CategoryID mCategoryId = CategoryID.OTHER;
    private String mTitle = null;
    private String mSubtitle = null;
    private String mMessage = null;
    private String mAppIdentifier = null;
    private List<Pair<String, String>> mAttributes = new ArrayList();

    public void truncate() {
        if (!TextUtils.isEmpty(this.mTitle) && this.mTitle.length() > 100) {
            this.mTitle = this.mTitle.substring(0, 100);
        }
        if (!TextUtils.isEmpty(this.mSubtitle) && this.mSubtitle.length() > 1000) {
            this.mSubtitle = this.mSubtitle.substring(0, 1000);
        }
        if (TextUtils.isEmpty(this.mMessage) || this.mMessage.length() <= 1000) {
            return;
        }
        this.mMessage = this.mMessage.substring(0, MAX_CONTENT_DESCRIPTION_LENGTH);
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        try {
            ExtensionData extensionData = (ExtensionData) obj;
            if (this.mEventId.value() != extensionData.mEventId.value() || !TextUtils.equals(extensionData.mTitle, this.mTitle) || !TextUtils.equals(extensionData.mSubtitle, this.mSubtitle)) {
                return false;
            }
            return TextUtils.equals(extensionData.mMessage, this.mMessage);
        } catch (ClassCastException unused) {
            return false;
        }
    }

    private static boolean objectEquals(Object obj, Object obj2) {
        if (obj == null || obj2 == null) {
            return obj == obj2;
        }
        return obj.equals(obj2);
    }

    public static boolean equals(ExtensionData extensionData, ExtensionData extensionData2) {
        if (extensionData == null || extensionData2 == null) {
            return extensionData == extensionData2;
        }
        return extensionData.equals(extensionData2);
    }

    public EventID eventId() {
        return this.mEventId;
    }

    public ExtensionData setEventId(EventID eventID) {
        this.mEventId = eventID;
        return this;
    }

    public EventFlags eventFlag() {
        return this.mEventFlag;
    }

    public ExtensionData setEventFlag(EventFlags eventFlags) {
        this.mEventFlag = eventFlags;
        return this;
    }

    public ExtensionData setCategoryID(CategoryID categoryID) {
        this.mCategoryId = categoryID;
        return this;
    }

    public CategoryID categoryID() {
        return this.mCategoryId;
    }

    public String title() {
        return this.mTitle;
    }

    public ExtensionData setTitle(String str) {
        this.mTitle = str;
        return this;
    }

    public String subtitle() {
        return this.mSubtitle;
    }

    public ExtensionData setSubtitle(String str) {
        this.mSubtitle = str;
        return this;
    }

    public String message() {
        return this.mMessage;
    }

    public ExtensionData setMessage(String str) {
        this.mMessage = str;
        return this;
    }

    public String appIdentifier() {
        return this.mAppIdentifier;
    }

    public ExtensionData setAppIdentifier(String str) {
        this.mAppIdentifier = str;
        return this;
    }

    public int icon() {
        return this.mIcon;
    }

    public ExtensionData setIcon(int i) {
        this.mIcon = i;
        return this;
    }

    public ExtensionData setAttribute(String str, String str2) {
        this.mAttributes.add(new Pair<>(str, str2));
        return this;
    }

    public List<Pair<String, String>> attributes() {
        return this.mAttributes;
    }
}
